home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / os2 / edm0407s.zip / STAT3SRC.ZIP / PROCSSTA.HPP < prev    next >
C/C++ Source or Header  |  1996-05-27  |  4KB  |  75 lines

  1. ////////////////////////////////////////////////////////////////////
  2. //                                                                //
  3. // PROCSSTA.HPP - declares the class AProcessStatus               //
  4. //                a progress indicating status line               //
  5. //                                                                //
  6. ////////////////////////////////////////////////////////////////////
  7.  
  8. #ifndef _PROCSSTA_HPP_
  9. #define _PROCSSTA_HPP_
  10.  
  11. #define INCL_PM
  12. #define INCL_WINWINDOWMGR
  13. #define INCL_WINMESSAGEMGR
  14. #include <os2.h>
  15.  
  16. #include <istattxt.hpp>
  17. #include <ipainhdr.hpp>
  18. #include <ifont.hpp>
  19. #include <ipoint.hpp>
  20.  
  21. #include "stamsgh.hpp"
  22.  
  23. typedef struct _PROCESS_START_PARAMS { // keeps the parameters needed when a process starts
  24.    ULONG ulProcessSize,                // the total size of the process, e.g. a file's size in bytes
  25.          ulTickSize;                   // the progress size per tick, e.g. the bytes read per reading
  26.    LONG lResourceId;                   // the resource id of the text which names the process
  27. } PROCESS_START_PARAMS;
  28.  
  29. class AProcessStatus : public IStaticText, 
  30.                        public IPaintHandler,
  31.                        public AStatusHandler
  32. {
  33.   public:
  34.     AProcessStatus (IWindow * parentWindow);       // constructor
  35.     ~AProcessStatus (void);                        // destructor
  36.  
  37.   protected:
  38.     void resetAllVariables (void);                 // reset all variable members when created
  39.     Boolean paintWindow (IPaintEvent& evt);        // handles WM_PAINT messages
  40.     Boolean paintStd (IPaintEvent& evt);           // standard painting
  41.     Boolean paintStartProcess (IPaintEvent& evt);  // painting to do when a process starts
  42.     Boolean paintPercentNumber (IPaintEvent& evt); // painting to do when the percent number changes
  43.     Boolean paintSlider (IPaintEvent& evt);        // painting to do when the slider size changes
  44.     Boolean startProcess (IEvent& evt);            // handles MYM_STATUS_START_PROCESS messages
  45.     Boolean proceed (IEvent& evt);                 // handles MYM_STATUS_PROCEED messages
  46.     Boolean endProcess (IEvent& evt);              // handles MYM_STATUS_END_PROCESS messages
  47.  
  48.   private:
  49.     enum ePaintWhat { ePaintStd = 0, ePaintStartProcess = 1, ePaintPercentNumber = 2, ePaintSlider = 3 };
  50.  
  51.     IFont * m_pFont;                  // keeps the fonts to calculate a text width
  52.     ULONG m_ulY;                      // y-coordinate of the text and percent number
  53.     LONG m_lStartSliderX,             // x-coordinate where the slider begins
  54.          m_lStartPercentNumberX,      // x-coordinate where the actual displayed percent number begins
  55.          m_lEndPercentNumberX,        // x-coordinate where the actual displayed percent number ends
  56.          m_lWidth,                    // width in dots of displayed text
  57.          m_lResourceId,               // resource id of the text which names the process
  58.          m_lPercentNumberMaxXRight;   // largest right-end-x-coordinate of the percent number
  59.     ULONG m_ulTotalTicks,             // total number of ticks the status line will receive
  60.           m_ulActualTick,             // number of ticks actually received
  61.           m_ulPercentReady,           // percent of the process done
  62.           m_ulPercent,                // between-variable
  63.           m_ulNewSliderSize,          // slider's new size in dots
  64.           m_ulOldSliderSize;          // slider's old size in dots
  65.     char m_szBuffer[81];              // string buffer
  66.     ePaintWhat m_nPaintWhat;          // tells what to paint when the event was sent by the status line itself
  67.     Boolean m_bProcessIsRunning,      // does the status line shows the progress of a process (== true if so)?
  68.             m_bPaintSentByMe;         // did the status line sent a paint event itself (== true if so)?
  69.     double m_dSizePerTick;            // slider size per tick
  70.     RECTL m_Rectl;                    // between-variable
  71.     POINTL m_Point;                   // between-variable
  72. };
  73.  
  74. #endif // _PROCSSTA_HPP_
  75.